using System.ComponentModel.DataAnnotations;

namespace KnowledgeQA.Models.DTOs
{
    /// <summary>
    /// 文档DTO
    /// </summary>
    public class DocumentDTO
    {
        /// <summary>
        /// 文档ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 文档标题
        /// </summary>
        public string Title { get; set; } = string.Empty;

        /// <summary>
        /// 文档描述
        /// </summary>
        public string? Description { get; set; }

        /// <summary>
        /// 文档类型
        /// </summary>
        public string FileType { get; set; } = string.Empty;

        /// <summary>
        /// 文件大小（字节）
        /// </summary>
        public long FileSize { get; set; }

        /// <summary>
        /// 文件大小（格式化显示）
        /// </summary>
        public string FileSizeFormatted { get; set; } = string.Empty;

        /// <summary>
        /// 文档分类ID
        /// </summary>
        public int? CategoryId { get; set; }

        /// <summary>
        /// 文档分类名称
        /// </summary>
        public string? CategoryName { get; set; }

        /// <summary>
        /// 文档标签
        /// </summary>
        public List<string> Tags { get; set; } = new List<string>();

        /// <summary>
        /// 处理状态
        /// </summary>
        public string Status { get; set; } = string.Empty;

        /// <summary>
        /// 是否已向量化
        /// </summary>
        public bool IsVectorized { get; set; }

        /// <summary>
        /// 文档版本
        /// </summary>
        public int Version { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime UpdatedAt { get; set; }

        /// <summary>
        /// 文档块数量
        /// </summary>
        public int ChunkCount { get; set; }
    }

    /// <summary>
    /// 创建文档请求DTO
    /// </summary>
    public class CreateDocumentRequest
    {
        /// <summary>
        /// 文档标题
        /// </summary>
        [Required]
        [MaxLength(200)]
        public string Title { get; set; } = string.Empty;

        /// <summary>
        /// 文档描述
        /// </summary>
        [MaxLength(1000)]
        public string? Description { get; set; }

        /// <summary>
        /// 文档分类ID
        /// </summary>
        public int? CategoryId { get; set; }

        /// <summary>
        /// 文档标签
        /// </summary>
        public List<string> Tags { get; set; } = new List<string>();
    }

    /// <summary>
    /// 更新文档请求DTO
    /// </summary>
    public class UpdateDocumentRequest
    {
        /// <summary>
        /// 文档标题
        /// </summary>
        [Required]
        [MaxLength(200)]
        public string Title { get; set; } = string.Empty;

        /// <summary>
        /// 文档描述
        /// </summary>
        [MaxLength(1000)]
        public string? Description { get; set; }

        /// <summary>
        /// 文档分类ID
        /// </summary>
        public int? CategoryId { get; set; }

        /// <summary>
        /// 文档标签
        /// </summary>
        public List<string> Tags { get; set; } = new List<string>();
    }

    /// <summary>
    /// 文档查询请求DTO
    /// </summary>
    public class DocumentQueryRequest
    {
        /// <summary>
        /// 关键词
        /// </summary>
        public string? Keyword { get; set; }

        /// <summary>
        /// 分类ID
        /// </summary>
        public int? CategoryId { get; set; }

        /// <summary>
        /// 文件类型
        /// </summary>
        public string? FileType { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public string? Status { get; set; }

        /// <summary>
        /// 标签
        /// </summary>
        public List<string> Tags { get; set; } = new List<string>();

        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime? StartTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime? EndTime { get; set; }

        /// <summary>
        /// 页码
        /// </summary>
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页大小
        /// </summary>
        public int PageSize { get; set; } = 20;

        /// <summary>
        /// 排序字段
        /// </summary>
        public string SortBy { get; set; } = "CreatedAt";

        /// <summary>
        /// 是否降序
        /// </summary>
        public bool IsDescending { get; set; } = true;
    }
} 